const Article = require('../../models/article')

module.exports = async (req, res) => {
  const count = await Article.countDocuments({})
  Article.find((err, articleDoc) => {
    if (err) {
      return res.status(500).json({
        err_code: 500,
        message: err.message
      })
    }
    // 查询成功判断
    res.status(200).json({
      err_code: 0,
      data: articleDoc,
      // pagecount: total,
      count,
      // pagesize,
      message: 'success'
    })
  })
}